package ioc

import (
	"context"
	goredislib "github.com/go-redis/redis/v8"
	"github.com/spf13/viper"
	"shop_srvs/inventory_srv/global"
)

func InitRedis() {
	global.RedisClient = goredislib.NewClient(&goredislib.Options{
		Addr:     viper.GetString("redis.address"),
		Password: viper.GetString("redis.password"),
	})
	if _, err := global.RedisClient.Ping(context.Background()).Result(); err != nil {
		panic(err)
	}
}
